from django.utils.deprecation import MiddlewareMixin
from django.shortcuts import redirect

"""需要在settings.py注册中间件, settings.py中按顺序访问中间件"""

class SessionMiddleware(MiddlewareMixin):
    """中间件1"""
    def process_request(self, request):
        if(request.path_info == '/'):
            return redirect('/index/')
            
        return 